import { Controller, Get, UseGuards } from '@nestjs/common';
import { CommonService } from './common.service';
import { JwtGuard } from '../guards/jwt.guards';
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@Controller('common')
@UseGuards(JwtGuard) // 校验token是否通过
@ApiTags('下拉框数据源')
export class CommonController {
  constructor(private readonly commonService: CommonService) {}

  @Get('/teachers')
  @ApiOperation({ summary: '教师' })
  findAllTeacher() {
    return this.commonService.findAllTeacher();
  }

  @Get('/majors')
  @ApiOperation({ summary: '专业' })
  findAllMajor() {
    return this.commonService.findAllMajor();
  }

  @Get('/roles')
  @ApiOperation({ summary: '角色' })
  findAllRoles() {
    return this.commonService.findAllRole();
  }

  @Get('/departments')
  @ApiOperation({ summary: '学院' })
  findAllDepartments() {
    return this.commonService.findAllDepartment();
  }

  @Get('/classRooms')
  @ApiOperation({ summary: '教室' })
  findAllClassRooms() {
    return this.commonService.findAllClassRoom();
  }

  @Get('/courses')
  @ApiOperation({ summary: '课程' })
  findAllCourses() {
    return this.commonService.findAllCourses();
  }

  @Get('/timeSlots')
  @ApiOperation({ summary: '上课时间' })
  findAllTimeSlot() {
    return this.commonService.findAllTimeSlot();
  }
}
